﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Text;

namespace AutoLoL.Entities
{
    public class MasteryTree : INotifyPropertyChanged
    {
        public MasteryTree(string name)
        {
            this.Name = name;
        }

        public string Name { get; private set; }

        public MasteryBuild MasteryBuild { get; set; }

        public MasteryValue[] MasteryValues { get; set; }

        public int TotalUsedPoints
        {
            get { return MasteryValues.Sum(c => c.CurrentRank); }
        }

        public void UpdateBindings()
        {
            OnPropertyChanged("TotalUsedPoints");
        }

        public event PropertyChangedEventHandler PropertyChanged;
        protected virtual void OnPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
            { 
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }
}
